<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jstl/core"
      xmlns:fn="http://java.sun.com/jsp/jstl/functions"
      xmlns:tr="http://myfaces.apache.org/trinidad"
      xmlns:mias="http://www.monsters.inc/mias">
<!-- 
     Everything outside the ui:composition tag will be ignored by Facelets!
-->
<ui:composition>
  <!--
       If no explicit header name is set, the columnName will be used
       to lookup the header name in the message bundle. Otherwise, the
       value set in headerName will be used to lookup the header text
       in the message bundle. It is not possible to use a literal text
       that is not in the message bundle.  
  -->
  <c:if test="#{empty headerName}">
    <c:set var="headerName" value="#{columnName}" />
  </c:if>

  <tr:column id="#{columnName}" sortProperty="#{columnName}"
             sortable="#{sortable}" groupBy="#{groupBy}" headerText="#{msg[headerName]}">
    <c:choose>
      <c:when test="#{custom}">
        <!-- prevent these variables to propagate to child components -->
        <c:set var="headerName" value=""/>
        <c:set var="custom" value=""/>
        <ui:insert />
      </c:when>
      <c:otherwise>
	    <h:outputText value="#{bean[columnName]}">
	      <ui:insert />
	    </h:outputText>
      </c:otherwise>
    </c:choose>
  </tr:column>
</ui:composition>
</html>
